import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-14
 * Time: 00:30
 */
public class CommonDivisor {
    //求2个整数的最大公约数
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();

        if(a > b){
            int temp = 0;
            while ( b!= 0){
                temp = b;
                b = a % b;
                a = temp;
            }
            System.out.println("最大公约数是 "+temp);
        } else if (a < b) {
            int temp = 0;
            while ( a!= 0) {
                temp = a;
                a = b % a;
                b = temp;
            }
            System.out.println("最大公约数是 "+temp);
        }else {
            System.out.println(a);
        }
    }
}
